package com.adam.example.entity.repository;

import co.elastic.clients.util.DateTime;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

@Document(indexName = "test_books")
@Data
public class Book {

    @Id
    private Long id;
    @Field(type = FieldType.Text)
    private String title;
    @Field(type = FieldType.Text)
    private String language;
    @Field(type = FieldType.Text)
    private String author;
    @Field(type = FieldType.Double)
    private Double price;
    @Field(name = "publish_time", type = FieldType.Date)
    private DateTime publishTime;  //要找es包下对应的类型，不能用java.util.Date
    @Field(type = FieldType.Text)
    private String description;

}
